<!DOCTYPE html>
<html  lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta name="viewport" content="width=device-width"/>
<meta content="yes" name="apple-mobile-web-app-capable">
<meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
<head th:include="include :: header"><!--<title>扫码发货</title>--></head>
<link th:href="@{/css/plugins/dropzone/basic.css}" rel="stylesheet"/>
<link th:href="@{/css/plugins/dropzone/dropzone.css}" rel="stylesheet"/>
<link th:href="@{/css/style.css?v=4.1.0}" rel="stylesheet">
<style>
    .textarea_div{
        width: 100%;
        height: 130px;
        border: 1px solid;
        padding: 2px 2px 2px 2px;
        line-height: inherit;
        overflow: auto;
        margin: 0;
        font: inherit;
        color: inherit;
        -webkit-appearance: textarea;
        background-color: white;
        -webkit-rtl-ordering: logical;
        flex-direction: column;
        cursor: text;
        white-space: pre-wrap;
        word-wrap: break-word;
        text-rendering: auto;
        letter-spacing: normal;
        word-spacing: normal;
        text-transform: none;
        text-indent: 0;
        text-shadow: none;
        display: inline-block;
        text-align: start;}

</style>
<body class="white-bg">
<div class="ibox-content">
    <form action="" method="post" class="form-horizontal m" id="form-sweepCodeLocationJ" >
        <input id="id" name="id"   type="hidden">
        <div class="form-horizontal m">

            <div class="form-group">
                <div class="">
                    <button type="submit" class="btn btn-primary" data-loading-text="Loading..." style="margin-left: 15px">confirm</button><!--  onclick="upload()" -->
                    <button onclick="$.modal.close()" class="btn btn-danger" type="button">close</button>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-8">
                    <input class="form-control mainSKU" placeholder="please enter your SKU"  type="text" name="mainSKU" id="mainSKU">
                </div>
            </div>
            <div class="well">
                <h3 id="reSKU"></h3>
                <span id="reLocation"></span>
            </div>
        </div>

    </form>

</div>

<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/jquery-migrate/jQuery.print.min.js}"></script>
<script th:src="@{/js/plugins/dropzone/dropzone.js}"></script>
<script th:src="@{/js/plugins/layer/layer.min.js}"></script>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script type="text/javascript">

    $(function () {
        $("#mainSKU").focus();
    })

    var prefix = ctx + "module/location"
    var prefix1 = ctx + "module/products"

    $("#form-sweepCodeLocationJ").validate({
        rules:{
            mainSKU:{
                required:true,
                remote: {
                    url: prefix1 + "/checkMainSKU",
                    type: "post",
                    dataType: "json",
                    data: {
                        "mainSKU" : function() {
                            return $.trim($("#mainSKU").val());
                        }
                    },
                    dataFilter: function(data, type) {
                        if (data == "1") return false;
                        else return true;
                    }
                }
            },
        },
        submitHandler: function(form) {
            var ids_str = $('#mainSKU').val();//文本框的条码id内容
            var  url = prefix + "/sweepCodeLocationJ"

                $.ajax({
                    cache : true,
                    type : "POST",
                    url : url,
                    data : {
                        mainSKU:ids_str,
                        // sign:'10702',
                    },
                    async : true,
                    error : function(request) {
                        $.modal.alertError("The system is busy, please refresh and try again！");
                    },
                    success : function(res) {
                        for(var key in res){
                            $('#reSKU').text("SKU:" + key);
                            $('#reLocation').text("Cargo is in the following position："+res[key]);
                        }

                    }
                });
        }
    });



</script>
</body>
</html>